package com.ruoyi.media.accountGroup.mapper;

import com.ruoyi.media.accountGroup.domain.MediaAccountGroup;
import com.ruoyi.media.accountGroup.domain.vo.MediaAccountGroupVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 账号分组Mapper接口
 *
 * @author dqw
 * @date 2023-05-26
 */
public interface MediaAccountGroupMapper extends BaseMapperPlus<MediaAccountGroupMapper, MediaAccountGroup, MediaAccountGroupVo> {


    /**
     * 根据账号数据查询当前账号是否有数据
     * @return
     */
    @Select("SELECT * FROM `media_account_group` WHERE user_id = #{userId} AND group_title = #{groupName}")
    List<MediaAccountGroup> getAccountDataByTitle(@Param("userId")Long userId, @Param("groupName")String groupName);

    /**
     * 清空分组数据
     * @param groupId
     * @return
     */
    @Update("UPDATE `media_account` SET group_id = '',group_name = '' WHERE group_id = #{groupId}")
    int updateGroupData(@Param("groupId")String groupId);



}
